package main

import (
	"algorithms/linkedList"
	"algorithms/linkedListQueue"
	"algorithms/linkedListStack"
	"fmt"
)

func main() {
	linkedList := linkedList.MakeLinkedList[Integer]()
	for i := 0; i < 5; i++ {
		linkedList.AddFirst(Integer(i))
		fmt.Println(linkedList)
	}
	linkedList.Add(2, 666)
	fmt.Println(linkedList)

	linkedList.Remove(2)
	fmt.Println(linkedList)

	linkedList.RemoveFirst()
	fmt.Println(linkedList)

	linkedList.RemoveLast()
	fmt.Println(linkedList)

	stack := linkedListStack.MakeLinkedListStack[Integer]()
	for i := 0; i < 5; i++ {
		stack.Push(Integer(i))
		fmt.Println(stack)
	}

	q := linkedListQueue.MakeLinkedListQueue[Integer]()
	for i := 0; i < 10; i++ {
		//变量，需手动装箱
		q.Enqueue(Integer(i))
		fmt.Println(q)
		if i%3 == 2 {
			q.DeEnqueue()
			fmt.Println(q)
		}
	}

}
